home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / hypercrd / xcmds / dvlprstc.hqx / Developer Stack 1.3r / card_22176.txt < prev    next >
Text File  |  1991-04-30  |  4KB  |  77 lines

  1. -- card: 22176 from stack: in.3r
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 2612
  5. -- name: DrawPict
  6.  
  7.  
  8. -- part 1 (button)
  9. -- low flags: 00
  10. -- high flags: A004
  11. -- rect: left=193 top=234 right=284 bottom=257
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 27056 / 27056
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Try This
  20. ----- HyperTalk script -----
  21. on mouseUp
  22.   put "wierd,300,200"&return into pictSpec
  23.   put "scale,300,100" after pictSpec
  24.   drawPict rect of bkgnd field "syntax",pictSpec
  25.   wait until the mouseclick is true
  26.   go to this card
  27. end mouseUp
  28.  
  29.  
  30.  
  31. -- part contents for background part 13
  32. ----- text -----
  33. 39
  34.  
  35. -- part contents for background part 30
  36. ----- text -----
  37. XCMD
  38.  
  39. -- part contents for background part 2
  40. ----- text -----
  41. DrawPict
  42.  
  43. -- part contents for background part 3
  44. ----- text -----
  45. This XCMD will quickly draw a number of PICT resources to the screen.  To  convert your art to PICT resources, see ClipToPICTRes*.
  46.  
  47. People are encouraged to use these freely, but they will not be supported.
  48. If anyone is interested in the source code, or have questions, they can
  49. contact me at:
  50.  
  51. High Performance Systems
  52. 13 Dartmouth College Hwy
  53. Lyme, NH 03768
  54. Attn:  Michael McClennen
  55. (603)-795-4857
  56.  
  57. Michael is another of those loyal Developer Stack devotees who received the latest issue free because he donated this XCMD to the stack.  Thanks, Mike.  [Editor]
  58.  
  59.  
  60. -- part contents for background part 10
  61. ----- text -----
  62. Syntax:
  63.  
  64. DrawPict <screenrect>,<picturespecs>...
  65.  
  66. Screenrect consists of four coordinates, separated either by spaces or by commas.  They designate the rectangle of the card to be affected by this XCMD.
  67.  
  68. The remaining parameters (up to 15) are lists of picture specifications.  Each list consists of one or more picture specs separated by carriage returns.  Each consists of a name and either two or four coordinates.  If two, then the PICT resource with the given name will be drawn with its top left corner at the given point.  If four, the picture will be drawn scaled to that rectangle.
  69.  
  70. A coordinate may be any valid HyperCard expression which does not contain a space or a comma (even in literals).  If a coordinate contains other than numeric digits, the XCMD will call back to HyperCard to evaluate it.
  71.  
  72. Result:
  73. The PICT resources named will be drawn in order on a white background offscreen and the result will be copied onto the current card clipped to the rectangle given in the first parameter.  If there is not enough memory or the first parameter does not contain a valid rectangle, the XCMD will do nothing.  Otherwise it will draw the white background and as many pictures as are valid.  A picture specification which is invalid for any reason (no PICT resource of that name found, invalid rectangle, coordinates out of the screen rectangle) will simply be skipped.
  74.  
  75. NOTE:  HyperCard does not know anything about this XCMD.  The next time anything is drawn on the screen (if you choose any tool or move any button or field, or if a dialog box comes up, or if you go to another card, etc...) the pictures will be overwritten.  If you want a picture to stay around staticly, the best way I have found to do so is to put in an  idle handler to draw it every 30 ticks or so.  That way it comes back as soon as it is overwritten.  I intended this XCMD mostly for animation, in whch case it should be executed often to draw the picture in different positions, different sizes, etc.  Note that it will itself overwrite all buttons, fields, HyperCard graphics, etc.
  76.  
  77.